package first.niuke.midding;

/**
 * @ClassName NC5
 * @description:
 * @author: 荣燊
 * @create: 2021-04-20 19:41
 **/
public class NC5 {
    public int sumNumbers (TreeNode root) {
        // write code here

        return 0;
    }

    int dfs(TreeNode root, int sum) {
        if (root == null) {
            return 0;
        }
        sum = sum*10 + root.val;
        if (root.left == null && root.right == null) {
            return sum;
        }
        return dfs(root.left, sum)+dfs(root.right, sum);
    }

    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;
    }
}

